@echo off
rem Copy files to local Oasis Montaj installations (required to make toolbar work)

setlocal 

call geosoft_tools
pushd %arkex_geosoft_dir%
title=Geosoft_Tools_v%ARKEX_GEOSOFT_TOOLS_VERSION%
echo.
rem setup directories
set diromv=
set dir32omv=C:\Program Files\Geosoft\Oasis montaj viewer
set dir64omv=C:\Program Files (x86)\Geosoft\Oasis montaj viewer

set dirom=
set dir32om=C:\Program Files\Geosoft\Oasis montaj
set dir64om=C:\Program Files (x86)\Geosoft\Oasis montaj

rem Setup for Oasis Montaj Viewer
rem check proper directory
IF EXIST "%dir32omv%" (goto x32omv)
IF EXIST "%dir64omv%" (goto x64omv)
goto chkomv

rem setup copy directory for Oasis Montaj Viewer
:x32omv
set diromv=%dir32omv%
goto setupom

:x64omv
set diromv=%dir64omv%
goto setupom

:chkomv
echo ***
echo Error: cannot find installation of Oasis Montaj Viewer.  
echo ***
echo Please enter the Oasis Montaj Viewer installation directory 
echo (i.e. C:\Program Files (x86)\Geosoft\Oasis montaj viewer)
echo Leave blank if it is not installed.
set /p diromv=": "
echo.
:setupom
rem check proper directory Oasis Montaj
IF EXIST "%dir32om%" (goto x32om)
IF EXIST "%dir64om%" (goto x64om)
goto chkom

rem setup copy directory Oasis Montaj
:x32om
set dirom=%dir32om%
goto run

:x64om
set dirom=%dir64om%
goto run

:chkom
echo Error: cannot find installation of Oasis Montaj.  
echo Please enter the Oasis Montaj installation directory (i.e. C:\Program Files (x86)\Geosoft\Oasis montaj)
echo Leave blank if it is not installed.
set /p dirom=": "

:run
echo \.svn\ > omit.tmp

rem installing ARKeX bar to viewer location
if "%diromv%"=="" goto noomv

echo Installing ARKeX_bar to %diromv% ...
xcopy ARKeX_bar "%diromv%" /E /F /I /R /V /Y /EXCLUDE:omit.tmp

:noomv
rem installing ARKeX bar and ARKeX Tools to full version location
if "%dirom%"=="" goto noom

echo Installing ARKeX_bar to %dirom% ...
xcopy ARKeX_bar "%dirom%" /E /F /I /R /V /Y /EXCLUDE:omit.tmp

echo Installing ARKeX_Tools to %dirom% ...
xcopy ARKeX_tools "%dirom%" /E /F /I /R /V /Y /EXCLUDE:omit.tmp

:noom

:end
if exist omit.tmp del omit.tmp

popd
pause
